<?php
require_once 'application/library/db/gcDaoFactory.php';
require_once 'application/constant/daoConfig.php';
/**
 * user_services_permissionEditService
 * @author    Soochow University
 * @version   1.0
 * @exclude   作  成  日：2011/04/07
 */

class user_services_permissionEditService {

    private $objDaoFactory;

    public function __construct(){
        $this->objDaoFactory = gcDaoFactory::getInstance();
    }

    public function pbSelUserPermissionInfo(){
        $objDao = $this->objDaoFactory->createDao(daoConfig::T_BA_M_USER_DAO);
        $arrReturn = $objDao->pbSelUserPermissionInfo();
        return $arrReturn;
    }
    
    public function pbUpdateUserPermissionInfo($arrUserId, $arrPermissionSel) {
        $objDao = $this->objDaoFactory->createDao(daoConfig::T_BA_M_USER_DAO);

        foreach ($arrUserId as $key => $UserId) {
             $objDao->pbUpdateUserPermissionInfo($UserId, $arrPermissionSel[$key]);;
        }
        return $intUpdate;
    }
    
    public function pbSelUserInfo() {
        $objDao = $this->objDaoFactory->createDao(daoConfig::T_BA_M_USER_DAO);
        $arrResult = $objDao->pbSelUserInfo();
        foreach ($arrResult as &$result) {
          switch ($result["TYPE_FG"]) {
            case "1" :
                $result["TYPE_NAME"] = "辅助系统管理员 ";
                break;
            case "2" :
                $result["TYPE_NAME"] = "电子元件管理员 ";
                break;
            case "4" :
                $result["TYPE_NAME"] = "超级管理员 ";
                break;
          }
        }
        return $arrResult;
    }

}